<template>
    <view class="content set">
        <view>
            <uni-list>
				<uni-list-item title="清除缓存" :rightText="cacheSize" @click="clearCache"/>
                <uni-list-item title="修改密码" @click="updatePwd"/>
            </uni-list>
        </view>
    </view>
</template>

<script>
	
	export default {
		data() {
			return {
				
			}
		},
		computed: {
			cacheSize() {
				let size = 0
				uni.getStorageInfo({
					success: function (res) {
						size = res.currentSize+'KB'
					}
				})
				return size
			}
		},
		methods: {
			clearCache() {
				uni.showModal({
					title: '提示',
					content: '您确定要清除缓存吗？',
					success: function (res) {
						if (res.confirm) {
							uni.clearStorage()
							setTimeout(function(){
								uni.reLaunch({
									url: '/pages/login/index'
								});
							},2000)
						}
					}
				})
			},
			updatePwd(){
				uni.navigateTo({
					url: '/pages/my/update'
				})
			}
		}
	}
</script>

<style lang="scss">
    .set{
       .title{
           text-align: center;
           color: #666;
           font-size: $uni-font-size-base;
		   padding-top: 20rpx;
       }
        .subtitle{
            text-align: center;
            color: #666;
            font-size: $uni-font-size-base;
            margin-top: 16rpx;
        }
    }
	
	.userDiv{
		background-color: #F4F5F6;
		padding: 40rpx 0; 
	}
	
	.qrCode {
		text-align: center;
	}
	
	.qrCode image {
		height: 120px;
		width: 120px;
	}
	
	.uni-list{
		border-bottom: 1px solid #F0F0F0;
	}
	
	.btnDiv {
	  padding: 10rpx 20rpx;
	  margin-top: 40rpx;
	}
</style>
